package com.itheima.stream;

import java.util.ArrayList;
import java.util.stream.Collectors;

public class Demo4Stream {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 1; i <= 10; i++) {
            list.add(i);
        }
        list.add(10);
        list.add(10);

        list.stream().filter(s -> s % 2 == 0)
                .collect(Collectors.toList())
                .forEach(s -> System.out.println(s));

        System.out.println("--------------");

        list.stream().filter(s->s % 2 == 0)
                .collect(Collectors.toSet())
                .forEach(s-> System.out.println(s));
    }
}
